package com.qingke;

import java.io.InputStream;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.qingke.mapping.UserMapper;
import com.qingke.pojo.User;

public class Dao {
	public Dao() {
		
	}

		
	String resource="mybatis_conf.xml";
	InputStream is =Dao.class.getClassLoader().getResourceAsStream(resource);
	SqlSessionFactory sqlSessionFactory =new SqlSessionFactoryBuilder().build(is);
	SqlSession sqlSession = sqlSessionFactory.openSession();
	
    public void addUser(User user){
    	UserMapper um=sqlSession.getMapper(UserMapper.class);
    	um.insertSelective(user);
    	sqlSession.commit();
    }
	

}
